﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class Manage : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {if (Session["User"]==null)
		{
			Response.Write("<script language=javascript>alert('您没有管理权限或者还没有登录，请先登录！');window.open('../login.aspx','_top');</script>");
			Response.End();
		}
		if(!Page.IsPostBack)
		{
			BindUserData();
		}
    }

	private void BindUserData()
	{
		///获取用户数据
		string sql = "select * from web_admin";
        DataSet ds = Socut.Data.ExecuteDataSet(sql);            
        UserView.DataSource = ds;
        UserView.DataBind();
	}
	
	protected void AddBtn_Click(object sender,EventArgs e)
	{
		Response.Redirect("Addmanage.aspx");
	}	
	
	protected void Button1_Click(object sender, EventArgs e)
    {
        string ids = Request.Form["mid"];
        if (string.IsNullOrEmpty(ids))
        {
            CommonFunction.ShowMessage("请选择要删除的项");
        }
        else
        {
            Socut.Data.ExecuteNonQuery("DELETE from web_admin where id in (" + ids + ")");
            CommonFunction.ShowMessage("删除成功","manage.aspx");
        }
    }

}
